<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'article-form',
	'enableAjaxValidation'=>true,
)); ?>
<style type="text/css">
input[type=text]{
	
	width:60%;
	
}
</style>

<?php 
	$this->widget('ext.editor.ueditor.ueditorWidget',array(
			'id'=>'editor',
//			'initialContent' => '<span style="color:#ccc">欢迎使用ueditor</span>',
//			'initialStyle' => 'body{margin:8px;font-family:"宋体";font-size:16px;}',
			'elementPathEnabled' => true,
			'autoFloatEnabled'=>true,
			//'topOffset'=>30,
			//编辑器底部距离工具栏高度(如果参数大于等于编辑器高度，则设置无效)
			//'toolbarTopOffset'=>400,
			'minFrameHeight' => 320,
			'initialFrameHeight'=>320,
// 			'minFrameWidth'=>800,
			'minFrameWidth'=>'100%',
//			'autoClearinitialContent' => true,
			'imagePath' => '/',
			'textarea' => 'content',

			'autoHeightEnabled' => true,
// 			'toolbars'=>array(array('Undo','Redo','|','ForeColor','BackColor', 'Bold','Italic','Underline','JustifyLeft','JustifyCenter','JustifyRight','InsertImage','ImageNone','ImageLeft','ImageRight','ImageCenter' )),
	));
	
	$this->widget('ext.poshytip.Poshytip');
	
?>

<script type="text/javascript" >
$(function(){

	

});
</script>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<div class="row">
		<?php echo $form->labelEx($model,'arc_title'); ?>
		<?php echo $form->textField($model,'arc_title',array('size'=>60,'maxlength'=>200, 'font-size'=>'20px', 'title'=>'写日志标题')); ?>
		<?php echo $form->error($model,'arc_title'); ?>
	</div>
	
	<div style="display: block">
			<!--style给定宽度可以影响编辑器的最终宽度-->
			<script type="text/plain" id="editor" style="" name="Article[arc_content]">
				<?php echo $model->arc_content; ?>
			</script>
			<?php //echo $form->error($model,'content'); ?>
			<?php //echo $form->hiddenField($model, 'arc_content');?>
    		<?php echo $form->error($model,'arc_content'); ?>
	</div>

	<hr class="clearfix" />

	<div class="one-third  right" >
		  <div class="row">
	    		<?php echo Yii::t('article','Time');?>*：&nbsp;&nbsp;<span id="timelabel"><?php echo date('Y-m-d H:i:s',time());?></span>&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:void(0);" onclick="showNext($(this));">修改</a>
	    		<div class="hide">
	    			<?php echo $form->textField($model,'arc_created',array('value'=>date('Y-m-d H:i:s',time()),'title'=>'修改发布时间')); ?>
	    			<?php echo $form->error($model,'arc_created'); ?>		
	    		</div>	    
	    	</div>
		<hr class="clearfix" />
	
		<div class="row">
	    		<?php echo Yii::t('article','Comment')?>*：&nbsp;&nbsp;<span id="commentlabel"><?php echo Article::model()->getCommentState(Article::COMMENT_ALLOW);?></span>&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:void(0);" onclick="showNext($(this));">修改</a>
	    		<div class="hide">				
	    			<?php echo $form->dropDownList($model,'arc_iscomment',Article::model()->generateCommentStateDropdownList(),array(
	    					'style'=>'width:50%;',
	    					'title'=>'是否允许评论',
	    					'onchange'=>'changeText($(this),$(\'#commentlabel\'))'
	    					
	    			)); ?>
	    			<?php echo $form->error($model,'arc_iscomment'); ?>
	    		</div>	
		</div>
		<hr class="clearfix" />	
		<div class="row">
	    		<?php echo Yii::t('article','State')?>*：&nbsp;&nbsp;<span id="statelabel"><?php echo Article::model()->getNewsState(Article::STATUS_PUBLISHED);?></span>&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:void(0);" onclick="showNext($(this));">修改</a>
	    		<div class="hide">				
	    			<?php echo $form->dropDownList($model,'arc_state',Article::model()->generateStateDropdownList(),array(
	    					'style'=>'width:50%;',
	    					'title'=>'是否发布',
	    					'onchange'=>'changeText($(this),$(\'#statelabel\'))'
	    			)); ?>
	    			<?php echo $form->error($model,'arc_state'); ?>
	    		</div>
		</div>
		<hr class="clearfix" />
		<div class="row">
			<?php echo $form->labelEx($model,'arc_tags'); ?>			
			<?php echo $form->textField($model,'arc_tags',array('style'=>'width:60%;','size'=>60,'maxlength'=>100,'title'=>'请输入标签')); ?>
			<button type="button" class="download-itunes" id="get_tag" onclick="getTags();" >获取标签</button> 
	       	<?php echo $form->error($model,'arc_tags'); ?>
		</div>	
		<div class="row">
			<hr />
			<hr />
			<hr/>
			<button class="cupid-green"  type="submit"  id="arc_submit"><?php echo $model->isNewRecord?'提交':'更新';?></button>
			<hr />
			<hr />
			<?php echo $form->errorSummary($model); ?> 
		</div>
	</div>
	<div style="float:right;">
		<div class="row">
			<?php echo $form->labelEx($model,'arc_cid'); ?>
		</div>
		
		<div class="row"  style="overflow-y:auto; padding:5px; min-width:250px;max-height:200px;">
			<div class="widget" >
	              <?php 
					echo UtilTree::generateCheckTreeByType(Category::CATEGORY_NEWS, 'checkItem', array('class'=>'categories','id'=>'categoryList'));
			    	//$this->widget('application.components.school.category.articleCategoryList');
			   	?> 				
			</div>			
			<input type="hidden" id="Article_arc_cids" name="Article[arc_cids]"/>
			<textarea rows="3" style="display:none;" cols="20" id="Article_arc_result" name="Article[arc_result]"></textarea>
  
    	</div>	
    	
    	<div class="row">
        	&nbsp;&nbsp;<span id="categorylabel"><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:void(0);" onclick="showNext($(this));" >增加分类</a>
            
	       	<div class="hide">	<br />
	               <div style="margin:0px;">
	                   <?php echo $form->dropDownList($model,'arc_cid', Category::model()->getCategoryDropdownList(Category::CATEGORY_NEWS),array(
	                   			'title'=>'选择分类'
	                   		)); ?>
	
	                   <?php echo $form->error($model,'arc_cid'); ?>
	               </div>
		           <div  style="padding-top:10px;">
	                  	
	        		  <input type="text" id="categoryName" name="categoryName" title="输入新分类"/>	
	               </div>
	                <br />
	                <button class="minimal" id="add_category" type="button"  title="添加分类">添加分类</button>    		
	    	</div>	 
    	</div>
		

	</div>
<?php $this->endWidget(); ?>
